<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="/his/styles/default.css" type="text/css"
	media="screen" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<title>首页</title>
</head>
<body>
<div id="wrapper">
<div id="header"><div id="logo">
<h1>TriColor</h1>
<p>design by Free CSS Templates</p>
</div></div>
<div id="toolbar">
<ul>
	<li class="current_page_item"><a href="#">患者基本资料</a></li>
	<li><a href="#">医生信息维护</a></li>
	<li><a href="#">Photos</a></li>
	<li><a href="#">About</a></li>
	<li><a href="#">Links</a></li>
	<li><a href="#">Contact</a></li>
</ul></div>
<div id="container">
<div id="container-margin">
<div id="sidebar"><ul>
	<li>
	<h2>Aliquam tempus</h2>
	<p>Mauris vitae nisl nec metus placerat perdiet est. Phasellus
	dapibus semper consectetuer hendrerit.</p>
	</li>
	<li>
	<h2>Categories</h2>
	<ul>
		<li><a href="#">Aliquam libero</a></li>
		<li><a href="#">Consectetuer adipiscing elit</a></li>
		<li><a href="#">Metus aliquam pellentesque</a></li>
		<li><a href="#">Suspendisse iaculis mauris</a></li>
		<li><a href="#">Urnanet non molestie semper</a></li>
		<li><a href="#">Proin gravida orci porttitor</a></li>
	</ul>
	</li>
</ul>
</div>
<div id="content"><?xml version="1.0" encoding="UTF-8" ?>

<h2 class="title">HERE it is.</h2>
</div>
</div>
</div>
<div id="footer"><p>Copyright (c) 2008 Sitename.com. All rights reserved. Design by
Free CSS Templates.</p></div>
</div>
</body>
</html>
<script type="text/javascript"><!--
	$(function() {
		$('.date-pick').datePicker( {
			clickInput : true,
			createButton : false,
			startDate : '2000-01-01'
		}).val(new Date().asString()).trigger('change');
	});
</script>

hiabernate+Struts 分页
环境：Eclipse3.3+MyEclipse6.0GA+SQL2000

前段时间在网上看到了几个人写的分页好多都是从其他人的基础上修改而来的。其实在用Hibernate来实现分页实在是再简单不过
Query对象中的.setFirstResult()和.setMaxResults()就已经可以实现分页的查询。只是需要在页面中作几个业务处理就可以达到分页的效果
自己写了一个分页，希望高手指导指导

.java类文件：
PaginationLogic.java
---------------------------------------------------------------------------------------------------------
package pageination;

import java.util.Collection;

import org.hibernate.Session;
import org.hibernate.Transaction;

import zhudonghua.HibernateSessionFactory;

public class PaginationLogic {
public PaginationLogic() {
  
}

/*******************************
*该方法主要是获得数据库中*
*所有数据库的总行数，   *
*用于在页面中实现所分数 *
*******************************/
/**
* @param tableName
* @return int
*/
public int getDataCont(String tableName) {
   int cont = 0;

   Session session = HibernateSessionFactory.getSession();
   Transaction tran = session.beginTransaction();

   Integer cos = (Integer) session.createQuery(
     "select count(*) from " + tableName).uniqueResult();

   cont = cos.intValue();

   tran.commit();
   session.close();
   System.out.println("PaginationLogic Count"+cont);
   return cont;
}

/*******************************
*该方法主要是获得数据库中*
*想查询的数据行数        *
*int first 开始的索引    *
*int max   查询的行数    *
*String tableName 表名   *
*******************************/
/**
* @param first
* @param max
* @return list
*/
public Collection findALl(int first, int max,String tableName) {

   Session session = HibernateSessionFactory.getSession();

   Transaction tran = session.beginTransaction();

   Collection list = session.createQuery("from "+tableName).setFirstResult(first)
     .setMaxResults(max).list();

   tran.commit();
   HibernateSessionFactory.closeSession();

   return list;
}

}

Page.Java
